<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace common\traits;

use common\models\member\Member;
use common\models\member\MemberAuthent;
use common\models\vipcard\Vipcard;

/**
 * Description of Constants
 *
 * @author emhome
 */
trait Userinfo {

    /**
     * 用户基本信息
     * Get member portrait as url avatar.
     * @return string
     */
    public function getUser() {
        return $this->hasOne(Member::className(), ['uid' => 'uid']);
    }

    /**
     * 用户认证信息
     * Get member portrait as url avatar.
     * @return string
     */
    public function getAuthent() {
        return $this->hasOne(MemberAuthent::className(), ['uid' => 'uid']);
    }

    /**
     * 用户认证信息
     * Get member portrait as url avatar.
     * @return string
     */
    public function getCard() {
        return $this->hasOne(Vipcard::className(), ['uid' => 'uid'])->andWhere(['status' => Vipcard::STATUS_ACTIVE]);
    }

}
